import os, shutil, glob 


#eventdir = 'C:\WorkSpace\python_modules\data\Event'
#regionsdir = 'C:\WorkSpace\python_modules\data\Region1'

eventdir = ''
regionsdir = ''

for root, dirs, files in os.walk(regionsdir, topdown=True):
	for name in files:
		index = name.rfind('_')
		if index != -1:
                        eventid = name[index+1:-4]
                        filepattern = eventdir+"\*"+eventid+"*"
                        filesevt = glob.glob(filepattern)
			if len(filesevt) > 0:
                            neweventdir = root +"\Event"
                            os.mkdir( neweventdir )
                            for fe in filesevt:
                                shutil.copy( fe, neweventdir )
                                
                            
			
        
